import type { WalletKitWalletConnectParameters, Wallet } from '../../../types/Wallet'
import { getWalletConnectConnector } from '../../getWalletConnectConnector'
import { walletConnectWalletIcon } from './walletConnectWalletIcon'

export interface WalletConnectWalletOptions {
  projectId: string
  options?: WalletKitWalletConnectParameters
}

export const walletConnectWallet = ({ projectId, options }: WalletConnectWalletOptions): Wallet => {
  const getUri = (uri: string) => uri

  return {
    id: 'walletConnect',
    name: 'WalletConnect',
    installed: undefined,
    iconUrl: walletConnectWalletIcon,
    iconBackground: '#3b99fc',
    qrCode: { getUri },
    createConnector: getWalletConnectConnector({
      projectId,
      walletConnectParameters: options
    })
  }
}
